package com.kdgz.kdgz.sevice.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kdgz.kdgz.beans.Orders;
import com.kdgz.kdgz.mapper.OrdersMapper;
import com.kdgz.kdgz.sevice.OrdersService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Desc
 * @date 2021/3/18
 */
@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public Integer addOrder(Orders order) {
        return ordersMapper.insert(order);
    }

    @Override
    public Integer deleteOrder(Integer id) {
        return ordersMapper.deleteById(id);
    }

    @Override
    public List<Orders> selectOrders() {
        return ordersMapper.getAllOrders();
    }

    @Override
    public Integer updateOrder(Orders order) {
        return ordersMapper.updateById(order);
    }

    @Override
    public List<Orders> getOrdersBySid(Integer sid) {
        return ordersMapper.getOrdersBySid(sid);
    }

    @Override
    public List<Orders> getOrdersBySidAndStatus(Integer sid, Integer status) {
        return ordersMapper.getOrdersBySidAndStatus(sid,status);
    }

    @Override
    public List<Orders> getOrdersBySidInMonth(Integer sid, Integer year, Integer month) {
        return ordersMapper.getOrdersBySidInMonth(sid,year,month);
    }

    @Override
    public List<Orders> getOrdersByStatus(Integer status) {
        return ordersMapper.getOrdersByStatus(status);
    }

    @Override
    public List<Orders> getOrdersForSend() {
        return ordersMapper.getOrdersForSend();
    }

    @Override
    public BigDecimal getTotalPrice() {

        return ordersMapper.totalPrice();
    }

    @Override
    public BigDecimal getTotalPrice(Integer year) {
        return ordersMapper.totalPriceByYear(year);
    }

    @Override
    public BigDecimal getTotalPrice(Integer year, Integer month) {
        return ordersMapper.totalPriceByMonth(year,month);
    }

    @Override
    public Integer totalOrdersByMonth( Integer year, Integer month){return ordersMapper.totalOrdersByMonth(year,month);}

    @Override
    public Integer totalOrdersByStatus(Integer year, Integer month, Integer status) {
        return ordersMapper.totalOrdersByStatus(status,year,month);
    }

    @Override
    public BigDecimal totalPriceByDay(Integer year, Integer month, Integer day) {
        return ordersMapper.totalPriceByDay(year,month,day);
    }

}
